package com.taplinker.client.im.rpc.response;

import com.taplinker.client.AppConfigFactory;
import com.taplinker.client.App;
import com.taplinker.client.im.domain.ImDataCenter;
import com.taplinker.client.im.protocol.TapLinkerConversation;
import com.taplinker.client.im.rpc.body.Cmd004Rep;
import com.taplinker.client.im.rpc.body.ConvertUtil;
import com.taplinker.core.rpc.Result;
import com.taplinker.core.util.json.JsonUtil;

public class Cmd1005 implements ImResponse{

	@Override
	public void yes(Result result) {
		Cmd004Rep value = JsonUtil.jsonToObject(result.object.toString(), Cmd004Rep.class);
		
		TapLinkerConversation conversation = ConvertUtil.convertToConversation(value);
		conversation.setQueueType(TapLinkerConversation.PRIVATE_QUEUE);
		ImDataCenter.getInstance().addToPrivateQueue(conversation);
		
		((App)AppConfigFactory.getInstance().getApplication()).notifyMessage(
			"您收到来至（"
			+ value.getNickName()
			+ "）转接会话，备注："
			+ value.getReason());
	}

	@Override
	public String getCommand() {
		return "1005";
	}
	
}
